package com.ant.backstage;

import com.github.ltsopensource.spring.boot.annotation.EnableJobClient;
import com.github.ltsopensource.spring.boot.annotation.EnableJobTracker;
import com.github.ltsopensource.spring.boot.annotation.EnableMonitor;
import com.github.ltsopensource.spring.boot.annotation.EnableTaskTracker;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.ImportResource;

//@PropertySource("classpath:ltsApplication.properties") //加载自定义lts配置文件
@MapperScan("com.ant.backstage.dao")
//@ComponentScan(basePackages = {"com.ant.backstage.utils"})
// ComponentScan注解会使@SpringBootApplication注解中包含的@ComponentScan注解失效，所以需要将需要调用的公共类的路径以及自己所属项目的路径扫描进去；
@ImportResource("classpath:/spring/applicationContext-dubbo-provider.xml") //dubbo文件
@EnableCaching
@SpringBootApplication
@ServletComponentScan//springboot打war注解  自定义配置类继承 HttpServletRequestWrapper
@EnableJobClient        //JobClient      lts
@EnableTaskTracker      //TaskTracker    lts
@EnableJobTracker       //JobTracker     lts
@EnableMonitor          //Monitor        lts
public class BackstageApplication extends SpringBootServletInitializer {
    //因为是父子项目 需要制定一个主启动类打war  SpringBootServletInitializer
    @Override//重写configure方法
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(BackstageApplication.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(BackstageApplication.class, args);
        System.out.println("Application is Started !!! ");
    }
}
